package com.googlecode.openauth.web.dao;

import java.util.List;

import org.apache.ibatis.session.RowBounds;

import com.googlecode.openauth.web.entity.RMenu;
import com.googlecode.openauth.web.entity.RRole;
import com.googlecode.openauth.web.entity.RRoleArea;
import com.googlecode.openauth.web.entity.RRoleResource;
import com.googlecode.openauth.web.entity.RoleInfo;
import com.googlecode.openauth.web.entity.RoleAction;

public interface IRoleDao {
	
	public Object addRole(RoleInfo role);
	public void delRole(int roleId);
	public void updateRole(RoleInfo role);
	public List<RoleInfo> getRoles(RoleInfo role);
	public RoleInfo getRoleById(int roleId);
	public int getAllRolesCount(RoleInfo role);
	public List<RoleInfo> getAllRoles(RoleInfo role, RowBounds rowBounds);
	public int searchRolesCount();
	public List<RoleInfo> searchRoles(RoleInfo role, RowBounds rowBounds);
	public RoleInfo getParentRole(RoleInfo role);
	
	void addRoleAction(RRole relation);
	void addRoleAreaadRoleArea(RRoleArea relation);
	void addRoleResource(RRoleResource relation);
	void addRoleMenu(RMenu relation);
	
	void delRoleActionById(RRole relation);
	void delRoleAreaById(RRoleArea relation);
	void delRoleResourceById(RRoleResource relation);
	void delRoleMenuById(RMenu relation);
	
	public List<RRoleResource> getRoleResources(RRoleResource prm);
	public List<RMenu> getRoleMenus(RMenu prm);
	public List<RRoleArea> getRoleAreas(RRoleArea prm);
	public List<RoleAction> getRoleActions(RoleAction prm);
	
	public List<RoleInfo> getChildRoles(int roleId);
	public List<RoleInfo> getChildRolesLeaf2Root(int roleId);
	
}
